/***************************************************************************
 *   Copyleft 2008-2009 by												   *
 *	 Iwanicki Krzysztof													   *
 *   <gamma.mini.pw.edu.pl/~iwanickik>									   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 ***************************************************************************/
#ifndef __RESOURCESLOADER_H__
#define __RESOURCESLOADER_H__

#include "../../Exceptions/vExceptions.h"
#include "../FileIO//TinyXML/tinyxml.h"
#include "../../Utils/vUtils.h"
#include "../../Macros/vMemoryMacros.h"

namespace Vendetta {
	class vResourcesLoader {
	public:
		struct vEntryPair {
			vString mFileName;
			vString mResourceName;
		};
		typedef vArray<vEntryPair>	ResList;

	public:
		vResourcesLoader(const vString& fileName);
		virtual ~vResourcesLoader();
		vResourcesLoader(const vResourcesLoader& loader);
		
		vResourcesLoader& operator=(const vResourcesLoader& loader);

		ResList ResourceGroup(const vString& groupName);
		
	protected:
		vVoid loadFile(const vString& fileName);

		ResList loadTextures(TiXmlElement *pElem);

		vEntryPair loadTexture2d(TiXmlElement *pElem, const vString& dir);

		vVoid Print();

	private:
		vHashMap<vString, ResList> mResources;
		vString mFileName;
		
	};
}

#endif // __RESOURCESLOADER_H__